package com.st.ssdr.rabbitmq.controller;

import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class RabbitMQController {
	
	
	@Autowired
	private AmqpTemplate amqpTemplate;
	
	@RequestMapping(value="/produce")
	@ResponseBody
	public void produce() throws Exception{
	    System.out.println("发送");
	    amqpTemplate.convertAndSend("testKey", "Hello rabbitMq");
	}
	
}
